﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ForzaGT3.Data;
using System.Web.Mvc;

namespace ForzaGT3.Helpers
{
    public class DataHelper
    {
        public static IEnumerable<SelectListItem> GetLanguageSelectList()
        {
            List<SelectListItem> items = new List<SelectListItem>();
            IEnumerable<Language> languages = Language.GetAll();
            foreach (Language lang in languages)
            {
                SelectListItem item = new SelectListItem()
                {
                    Text = lang.Name,
                    Value = lang.LanguageId.ToString()
                };

                if (lang.IsDefault)
                    item.Selected = true;

                items.Add(item);
            }

            return items;
        }
    }
}